<?php
echo $breadcrumb;
?>
<div id="content">
    <div class="DivTable">
        <form name="fCari" id="fCari" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" >
            <table class="GridTableFilter">
                <?php
                echo $fp;
                ?>
                <tr>
                    <td>
                        <?php
                        echo $fp2;
                        ?>
                    </td>
                </tr>
            </table>
        </form>

        <script language="javascript">
            function removeData(kode) {

                if(confirm('Anda yakin akan menghapus data ini?')) {
                    location.href = '<?php echo base_url() ?>index.php/management/divisi_delete/' + kode;
                }
            }


            
        </script>

        <table class="GridTable" style="width:100%">
            <tr>
                <td colspan="20" class="noborder">
                    <div class="box-control">
                        <?php
                        echo Greybox::createLink(base_url() . "index.php/management/divisi_add", "", "Tambah Data", "add");
                        echo "<a href=\"#\" class=\"search\" title=\"Cari Data\">&nbsp;</a>";
                        echo "<a href=\"" . base_url() . "index.php/management/divisi\" class=\"refresh\" title=\"Muat Ulang\">&nbsp;</a>";
                        ?>
                    </div>
                </td>
            </tr>

            <tr class="GridHeader">
                <td width="20">No.</td>
                <td>&nbsp;</td>
                <td>ID Divisi</td>
                <td>Nama Divisi</td>
                <td>Inisial</td>

            </tr>

            <?php
            if ($numRows > 0) {
                $nomor = $post['offset'];
                foreach ($result as $row) {
                    $nomor++;
                    $kodecontent = $row->id_divisi;
                    $styleTR = "GridItem1";
                    ?>
                    <tr class="<?php echo $styleTR; ?>" >
                        <td onclick="javascript:detil('<?php echo $kodecontent; ?>')"><?php echo $nomor; ?></td>
                        <td>
                            <?php
                                echo Greybox::createLink(base_url() . "index.php/management/divisi_edit/" . $kodecontent . "", "", "Ubah Data", "edit");
                               echo "<a href=\"#\" class=\"delete\" title=\"Hapus Data\" onclick=\"javascript:removeData('" . $kodecontent . "')\">&nbsp;</a>";
                                
                                
                            ?>
                             </td>
                        <td onclick="javascript:detil('<?php echo $kodecontent; ?>')"><?php echo $row->id_divisi; ?></td>
                        <td onclick="javascript:detil('<?php echo $kodecontent; ?>')"><?php echo $row->divisi; ?></td>
                        <td onclick="javascript:detil('<?php echo $kodecontent; ?>')"><?php echo $row->divisi_sname; ?></td>
                        

                    </tr>	
                    <?php
                }
            } else {
                ?>
                <tr class="GridItem1">
                    <td colspan="20">Tidak ada data</td>
                </tr>	

                <?php
            }
            ?>
        </table>
    </div>
    <?php
    ?>
    <br class="bersih" />

</div>

<script type="text/javascript">

    function openURL(url) {
        open(''+ url +'', 'wndStaff', 'width=730,height=500,directories=0,location=0,resizable=1,scrollbars=1,toolbar=0,copyhistory=0,status=0');
        return false;
    }

    jQuery(document).ready(function(){
        jQuery(".tr_slide").hide();

        jQuery('.search').click(
        function(){
            jQuery(".tr_slide").slideToggle();
        }
    );

    });
    
</script>
